package DailyPractice.Day16;

/**
 * @author lumin
 * @date 2022/05/12 18:51
 **/
import java.util.Scanner;

public class PerfectNum{
    public static void main(String avgs[]){
        Scanner sc = new Scanner(System.in);
        int n = sc.nextInt();
        int count = 0;
        for(int i = 1;i < n;i++){
            if(perfectNum(i)){
                count++;
            }
        }
        System.out.println(count);
    }
    public static boolean perfectNum(int n){
        int sum = 0;
        for(int i = 1;i < n;i++){
            if(n % i == 0){
                sum += i;
            }
        }
        if(sum == n){
            return true;
        }else{
            return false;
        }
    }
}